﻿using System.Data.Entity.ModelConfiguration;
using BeautyTech.Core.Domain.Invoices;

namespace BeautyTech.Data.Configuration.Invoices
{
    public class InvoiceConfiguration : EntityTypeConfiguration<Invoice>
    {
        public InvoiceConfiguration()
        {
            this.Property(p => p.InvoiceNum).HasMaxLength(10).IsRequired();
            this.Property(p => p.Date).HasColumnType("date");
            this.Property(p => p.CustomerOrder).HasMaxLength(15).IsRequired();
            this.Property(p => p.CustomerInvoice).HasMaxLength(15).IsRequired();
            this.Property(p => p.Rep).HasMaxLength(4);
            this.Property(p => p.Reference).HasMaxLength(30);

            this.Property(p => p.DeliveryName).HasMaxLength(35);
            this.Property(p => p.DeliveryAddress1).HasMaxLength(40);
            this.Property(p => p.DeliveryAddress2).HasMaxLength(40);
            this.Property(p => p.DeliveryAddress3).HasMaxLength(40);
            this.Property(p => p.DeliveryPostalCode).HasMaxLength(10);
            this.Property(p => p.DeliveryCity).HasMaxLength(40);
            this.Property(p => p.DeliveryCountry).HasMaxLength(3);
            this.Property(p => p.DeliveryCountryName).HasMaxLength(40);

            this.Property(p => p.BillingName).HasMaxLength(35);
            this.Property(p => p.BillingAddress1).HasMaxLength(40);
            this.Property(p => p.BillingAddress2).HasMaxLength(40);
            this.Property(p => p.BillingAddress3).HasMaxLength(40);
            this.Property(p => p.BillingPostalCode).HasMaxLength(10);
            this.Property(p => p.BillingCity).HasMaxLength(40);
            this.Property(p => p.BillingCountry).HasMaxLength(3);
            this.Property(p => p.BillingCountryName).HasMaxLength(40);


            this.Property(p => p.Currency).HasMaxLength(3);
        }
    }
}
